<?php
  if(!$_COOKIE['UserID']){
    HEADER("location:./login.html");
  }
  include "./php/pdo-plus/src/PDO.class.php";
  include "./php/fn.php";
  include "./php/config.php";
  $db=DB::getInstance($database);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>房源列表</title>
<style type="text/css">
.ys01 {	font-size: 24px;
}
.ys01 {	font-size: 36px;
}
.ys01 {	font-size: 14px;
}
.ys01 {	font-size: 12px;
}
.ys02 {	text-align: left;
	font-size: 36px;
}
.ys03 {	font-size: 24px;
	font-weight: bold;
}
.ys04 {	color: #F00;
	font-size: 24px;
}
.ys04 {}
.ys05 {
	font-size: 16px;
}
.ys06 {	font-size: 14px;
}
.ys01 {
	text-align: left;
}
.ys08 {
	text-align: left;
}
.ys011 {	font-size: 24px;
}
.ys011 {	font-size: 36px;
}
.ys011 {	font-size: 14px;
}
.ys011 {	font-size: 12px;
}
</style>
</head>

<body>
<table width="100%" border="0" align="center">
    <?php include "header.php";?>
    </table>
      <table width="100%" border="0">
        <tr>
          <th height="200" scope="col">合租.配图</th>
        </tr>
      </table>
      <table width="1000" border="0" align="center">
        <tr>
          <th scope="col"><table width="100%" border="0">
            <tr>
              <th scope="col"><table width="100%" border="0">
                <tr>
                  <th width="80%" scope="col"><table width="90%" border="1" align="right">
                    <tr>
                      <th height="50" scope="col">&nbsp;</th>
                      <th width="120" height="50" bgcolor="#3399CC" scope="col">搜索</th>
                    </tr>
                  </table></th>
                  <th scope="col"><table border="1">
                    <tr>
                      <th width="120" height="50" bgcolor="#3399CC" scope="col">地图找房</th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th scope="col"><table width="90%" border="0" align="right">
                    <tr>
                      <th class="ys01" scope="col">热门搜索： <a href="https://www.dankegongyu.com/room/bj/x%E7%8E%B0%E6%88%BF.html">现房</a> <a href="https://www.dankegongyu.com/room/bj/n1.html?from=hot_keywords">一居室</a> <a href="https://www.dankegongyu.com/room/bj?from=hot_keywords&amp;search_text=%E5%9B%9E%E9%BE%99%E8%A7%82">回龙观</a> <a href="https://www.dankegongyu.com/room/bj?from=hot_keywords&amp;search_text=%E5%8F%8C%E4%BA%95">双井</a> <a href="https://www.dankegongyu.com/room/bj?from=hot_keywords&amp;search_text=%E5%A4%A9%E9%80%9A%E8%8B%91">天通苑</a> <a href="https://www.dankegongyu.com/room/bj?from=hot_keywords&amp;search_text=%E9%9D%92%E5%B9%B4%E8%B7%AF">青年路</a> <a href="https://www.dankegongyu.com/room/bj?from=hot_keywords&amp;search_text=%E6%9C%9B%E4%BA%AC">望京</a> <a href="https://www.dankegongyu.com/room/bj">所有房源</a></th>
                    </tr>
                  </table></th>
                  <th scope="col">&nbsp;</th>
                </tr>
              </table></th>
            </tr>
            <tr>
              <th scope="row"><table width="100%" border="0">
                <tr>
                  <th height="30" scope="col"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">位置：</th>
                      <th width="8%" <?php echo isit(0,$_GET['near']??0,'bgcolor="#3399CC"'); ?> scope="col">   <a href="<?php echo gethref(["./list.php",["near",0]]);?>">不限</a>  </th>
                      <th scope="col"><table width="10%" border="0" align="left">
                        <tr>
                          <th scope="col" <?php echo isit(1,$_GET['near']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["near",1]]);?>">地铁</a></th>
                        </tr>
                      </table></th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th height="30" scope="row"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">&nbsp;</th>
                      <th width="8%" <?php echo isit(0,$_GET['pos']??0,'bgcolor="#3399CC"'); ?> scope="col"><a href="<?php echo gethref(["./list.php",["pos",0]]);?>">不限</a></th>
                      <th scope="col"><table width="60%" border="0" align="left">
                        <tr>
                        <?php
                          $zones=$db->query("SELECT id,name from zones ");
                          foreach ($zones as $key => $value) {
                            ?>
                             <th scope="col" <?php echo isit($value['id'],$_GET['pos']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["pos",$value['id']]]);?>"><?php echo $value['name'];?></a></th>
                            <?php
                          }
                        ?>
                        </tr>
                      </table></th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th height="30" scope="row"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">价格：</th>
                      <th width="8%" <?php echo isit(0,$_GET['price']??0,'bgcolor="#3399CC"'); ?> scope="col"><a href="<?php echo gethref(["./list.php",["price",0]]);?>">不限</a> </th>
                      <th scope="col"><table width="70%" border="0" align="left">
                        <tr>
                          <th scope="col" <?php echo isit(1,$_GET['price']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["price",1]]);?>">500元以下</a></th>
                          <th scope="col" <?php echo isit(2,$_GET['price']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["price",2]]);?>">500~1000元</a></th>
                          <th scope="col" <?php echo isit(3,$_GET['price']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["price",3]]);?>">1000~1500元</a></th>
                          <th scope="col" <?php echo isit(4,$_GET['price']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["price",4]]);?>">1500~2000</a></th>
                          <th scope="col" <?php echo isit(5,$_GET['price']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["price",5]]);?>">2000元以上</a></th>
                        </tr>
                      </table></th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th height="30" scope="row"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">居室：</th>
                      <th width="8%" <?php echo isit(0,$_GET['rooms']??0,'bgcolor="#3399CC"'); ?> scope="col"><a href="<?php echo gethref(["./list.php",["rooms",0]]);?>">不限</a></th>
                      <th scope="col"><table width="60%" border="0" align="left">
                        <tr>
                          <th width="25%" scope="col" <?php echo isit(1,$_GET['rooms']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["rooms",1]]);?>">一居室</a></th>
                          <th width="25%" scope="col" <?php echo isit(2,$_GET['rooms']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["rooms",2]]);?>">两居室</a></th>
                          <th width="25%" scope="col" <?php echo isit(3,$_GET['rooms']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["rooms",3]]);?>" >三居室</a></th>
                          <th scope="col" <?php echo isit(4,$_GET['rooms']??0,'bgcolor="#3399CC"'); ?> ><a href="<?php echo gethref(["./list.php",["rooms",4]]);?>">四居室以上</a></th>
                        </tr>
                      </table></th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th height="30" scope="row"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">类型：</th>
                      <th width="8%"  <?php echo isit(0,$_GET['zutype']??0,'bgcolor="#3399CC"'); ?> scope="col"><a href="<?php echo gethref(["./list.php",["zutype",0]]);?>">不限</a></th>
                      <th scope="col"><table width="60%" border="0" align="left">
                      <tr>
                      <th width="25%" scope="col" <?php echo isit(1,$_GET['zutype']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["zutype",1]]);?>">合租</a></th>
                      <th  scope="col" width="25%" <?php echo isit(2,$_GET['zutype']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["zutype",2]]);?>">整租</a></th>
                      </tr>
                      </table>
                      </th>
                    </tr>
                  </table></th>
                </tr>
                <tr>
                  <th height="30" scope="row"><table width="100%" border="0">
                    <tr>
                      <th width="8%" scope="col">特色：</th>
                      <th width="8%" <?php echo isit(0,$_GET['tese']??0,'bgcolor="#3399CC"'); ?> scope="col"><a href="<?php echo gethref(["./list.php",["tese",0]]);?>">不限</a></th>
                      <th scope="col"><table width="70%" border="0" align="left">
                        <tr>
                          <th width="14%" scope="col" <?php echo isit(1,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",1]]);?>">风格</a></th>
                          <th width="14%" scope="col" <?php echo isit(2,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",2]]);?>">朝向</a></th>
                          <th width="14%" scope="col" <?php echo isit(3,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",3]]);?>">面积</a></th>
                          <th width="14%" scope="col" <?php echo isit(4,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",4]]);?>">独卫</a></th>
                          <th width="14%" scope="col" <?php echo isit(5,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",5]]);?>">阳台</a></th>
                          <th width="14%" scope="col" <?php echo isit(6,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",6]]);?>">月付</a></th>
                          <th scope="col" <?php echo isit(7,$_GET['tese']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["tese",7]]);?>">悬赏</a></th>
                        </tr>
                      </table></th>
                    </tr>
                  </table></th>
                </tr>
              </table></th>
            </tr>
            <tr>
              <th scope="row"><table width="100%" border="0">
                <tr>
                  <th height="50" scope="col">&nbsp;</th>
                  <th width="10%" height="50" scope="col" <?php echo isit(0,$_GET['order']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["order",0]]);?>">默认排序</a></th>
                  <th width="10%" height="50" scope="col" <?php echo isit(1,$_GET['order']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["order",1]]);?>">价格升序</a></th>
                  <th width="10%" height="50" scope="col" <?php echo isit(2,$_GET['order']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["order",2]]);?>">价格降序</a></th>
                  <th width="10%" height="50" scope="col" <?php echo isit(3,$_GET['order']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["order",3]]);?>">面积升序</a></th>
                  <th width="10%" height="50" scope="col" <?php echo isit(4,$_GET['order']??0,'bgcolor="#3399CC"'); ?>><a href="<?php echo gethref(["./list.php",["order",4]]);?>">面积降序</a></th>
                </tr>
              </table></th>
            </tr>
            <tr>
              <th scope="row"><table width="90%" border="0" align="left">
                <?php
                  $near=intval($_GET['near'] ?? 0);
                  $pos=intval($_GET['pos'] ?? 0);
                  $price=intval($_GET['price'] ?? 0);
                  $rooms=intval($_GET['rooms'] ?? 0);
                  $zutype=intval($_GET['zutype '] ?? 0);
                  $tese=intval($_GET['tese'] ?? 0);
                  $order=intval($_GET['order'] ?? 0);
                  $page=intval($_GET['page'] ?? 1);
                  $size=20;
                  $sql=" from fang where 1=1 ";
                  $sqlarr=[];
                  if($near){
                    $sql.=" and ditie=? ";
                    $sqlarr[]=$near;
                  }
                  if($pos){
                    $sql.=" and zoneid=? ";
                    $sqlarr[]=$pos;
                  }
                  if($price){
                    $sql.=" and price ".["","<500","between 500 and 1000","between 1000 and 1500","between 1500 and 2000",">2000"][$price];
                  }
                  if($rooms){
                    $sql.=" and shi".["","=1","=2","=3",">=4"][$rooms];
                  }
                  if($zutype){
                    $sql.=" and zutype=？";
                    $sqlarr[]=$zutype;
                  }
                  if($tese){
                    $sql.=" and tese=？";
                    $sqlarr[]=$tese;
                  }
                    $sql.=" order by ".["id desc","price asc","price desc","mianji asc","mianji desc"][$order];
                  $sql.= " limit ".($page-1)*$size.",".$size;
                  $sql1="SELECT * ".$sql;
                  $fangscount=$db->query("select 1 ".$sql,$sqlarr);
                  $fangsnum=count($fangscount);
                  $fangs=$db->query($sql1,$sqlarr);
                  foreach ($fangs as $key => $value) {
                    ?>
                <tr>
                  <th width="250" height="150" scope="col"><img style="max-width: 100%;" src="./upload/<?php echo $value['mainimg'];?>" alt="" class="fangimg" /></th>
                  <th height="150" scope="col"><table width="90%" border="0" align="left">
                    <tr>
                      <th height="50" class="ys08" scope="col"><?php echo $value['xiaoqu'];?>，<?php echo $value['shi']; ?>室<?php echo $value['ting']; ?>厅，<?php echo $value['chaoxiang']; ?>，<?php echo $value['dizhi']; ?></th>
                    </tr>
                    <tr>
                      <th height="10" class="ys08" scope="row">                        ！距亦庄线旧宫站1150米</th>
                    </tr>
                    <tr>
                      <th height="10" class="ys08" scope="row"><?php echo $value['mianji']; ?>平，<?php echo $value['fanghao']; ?>室</th>
                    </tr>
                    <tr>
                      <th height="30" class="ys08" scope="row"><?php echo $value['info']; ?></th>
                    </tr>
                  </table></th>
                  <th width="20%" height="150" scope="col">¥<?php echo $value['price']; ?>元/月</th>
                </tr>

                    <?php
                  }
                 ?>

              </table></th>
            </tr>
          </table></th>
        </tr>
      </table>
      <table width="1000" border="0" align="center">
        <tr>
          <th height="60" scope="col">
            <?php

              $url='./list.php';
              echo getpage($page,ceil($fangsnum/$size),$url);
             ?>
          </th>
        </tr>
      </table>
      <table width="100%" border="0">
        <tr>
          <th scope="col"><table width="1000" border="0" align="center">
            <tr>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">用户帮助</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">入住指南</th>
                  </tr>
                  <tr>
                    <th scope="row">生活常识</th>
                  </tr>
                  <tr>
                    <th scope="row">常见问题</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">商务合作</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">商务合作</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">公司信息</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">关于我们</th>
                  </tr>
                  <tr>
                    <th scope="row">联系我们</th>
                  </tr>
                  <tr>
                    <th scope="row">加入我们</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">客服热线</th>
                </tr>
                <tr>
                  <th scope="row"><table width="100%" border="0">
                    <tr>
                      <th scope="col">0311-5555555</th>
                    </tr>
                    <tr>
                      <th scope="row">工作日 09:00-21:00</th>
                    </tr>
                    <tr>
                      <th scope="row">&nbsp;</th>
                    </tr>
                    <tr>
                      <th scope="row">&nbsp;</th>
                    </tr>
                  </table></th>
                </tr>
              </table></th>
              <th height="200" scope="col"><table width="100%" border="1">
                <tr>
                  <th scope="col">APP二维码</th>
                  <th scope="col">公众号二维码</th>
                </tr>
              </table></th>
            </tr>
          </table></th>
        </tr>
      </table>
      <table width="100%" border="0" align="center">
        <tr>
          <th scope="col"><table width="1000" border="0" align="center">
            <tr>
              <th width="20%" height="80" scope="col"><img src="logo.jpg" width="90" height="60" alt="logo" /></th>
              <th height="80" scope="col"><table width="90%" border="0">
                <tr>
                  <th class="ys011" scope="col">寓萌——公寓&amp;中介完美合作平台</th>
                </tr>
                <tr>
                  <th class="ys011" scope="row">本网站所有页面的数据统计均来源于寓萌数据库   联系客服：微信 周一至周日09:00-22:00</th>
                </tr>
              </table></th>
              <th width="15%" height="80" scope="col"><img src="标志.png" width="90" height="60" alt="标志" /></th>
            </tr>
          </table></th>
        </tr>
    </table></th>
  </tr>
</table>
</body>
</html>
